home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / prolog / ai.prl / dprolog.lha / mdd.pro < prev    next >
Text File  |  1991-03-05  |  2KB  |  104 lines

  1.  
  2. prescribe(Treatment,Ailment):=
  3.         indicated(Treatment,Ailment),
  4.         diagnosis(Ailment).
  5.  
  6. neg prescribe(Treatment,_):^
  7.         counter_indicated(Treatment).
  8.  
  9. prescribe(Treatment,Ailment):=
  10.         indicated(Treatment,Ailment),
  11.         diagnosis(Ailment),
  12.         counter_indicated(Treatment),
  13.         condition(critical).
  14.  
  15. neg prescribe(Treatment,Ailment):=
  16.         counter_indicated(Treatment),
  17.         indicated(AlternateTreatment,Ailment),
  18.         AlternateTreatment \= Treatment,
  19.         not counter_indicated(AlternateTreatment).
  20.  
  21. counter_indicated(Treatment):-
  22.         allergy(Treatment).
  23.  
  24. indicated(penicillin,pneumonia).
  25.  
  26. indicated(erythrocyn,strep_throat).
  27.  
  28. indicated(antihistamine,allergic_rhinitis).
  29.  
  30. diagnosis(allergic_rhinitis):=
  31.         symptom(nasal_congestion).
  32.  
  33. diagnosis(strep_throat):=
  34.         symptom(nasal_congestion),
  35.         symptom(sore_throat).
  36.  
  37. diagnosis(pneumonia):=
  38.         symptom(nasal_congestion),
  39.         symptom(chest_congestion).
  40.  
  41. neg diagnosis(allergic_rhinitis):^
  42.         symptom(sore_throat).
  43.  
  44. neg diagnosis(allergic_rhinitis):^
  45.         symptom(chest_congestion).
  46.  
  47. condition(fair):=true.
  48.  
  49. incompatible(condition(fair),condition(serious)).
  50.  
  51. incompatible(condition(fair),condition(critical)).
  52.  
  53. symptom(nasal_congestion).
  54.  
  55. allergy(penicillin).
  56.  
  57. history:-
  58.         symptom(X),
  59.         write('Symptom: '),
  60.         write(X),
  61.         nl,
  62.         fail.
  63.  
  64. history:-
  65.         allergy(X),
  66.         write('Allergic to: '),
  67.         write(X),
  68.         nl,
  69.         fail.
  70.  
  71. history:-
  72.         (@ condition(X)),
  73.         write('Condition: '),
  74.         write(X),
  75.         nl,
  76.         fail.
  77.  
  78. history.
  79.  
  80. diagnose:-
  81.         history,
  82.         nl,
  83.         fail.
  84.  
  85. diagnose:-
  86.         @ diagnosis(X),
  87.         write('Possible diagnosis: '),
  88.         write(X),
  89.         nl,
  90.         fail.
  91.  
  92. diagnose:-
  93.         @ prescribe(X,Y),
  94.         write('Prescribed treatment for '),
  95.         write(Y),
  96.         write(' is '),
  97.         write(X),
  98.         nl,
  99.         fail.
  100.  
  101. diagnose:-
  102.         nl.
  103.  
  104.